/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    min-height: 100vh;
    color: #333;
}

/* 容器布局 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 30px rgba(0,0,0,0.1);
}

/* 顶部导航 */
.header {
    background: linear-gradient(135deg, #1e1b4b 0%, #3730a3 100%);
    color: white;
    padding: 20px 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 2em;
    margin-bottom: 5px;
}

.logo p {
    opacity: 0.8;
    font-size: 0.9em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    font-size: 0.9em;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fbbf24;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: #10b981;
}

.status-dot.disconnected {
    background: #ef4444;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 导航标签 */
.nav-tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
}

.nav-tab {
    background: none;
    border: none;
    padding: 15px 20px;
    cursor: pointer;
    font-size: 0.9em;
    color: #64748b;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav-tab:hover {
    background: #e2e8f0;
    color: #475569;
}

.nav-tab.active {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
    background: white;
}

/* 标签页内容 */
.tab-content {
    display: none;
    padding: 30px;
    min-height: 600px;
}

.tab-content.active {
    display: block;
}

/* 区域标题 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.section-header h2 {
    color: #374151;
    font-size: 1.5em;
}

.section-actions {
    display: flex;
    gap: 10px;
}

/* 按钮样式 */
.btn {
    background: #4f46e5;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    background: #4338ca;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8em;
}

.btn-secondary {
    background: #6b7280;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-success {
    background: #10b981;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-primary {
    background: #4f46e5;
}

/* 测试网格 */
.test-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

/* 测试卡片 */
.test-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.test-header {
    background: #f8fafc;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.test-header h3 {
    font-size: 1.1em;
    color: #374151;
}

.test-body {
    padding: 20px;
    min-height: 150px;
}

.test-placeholder {
    color: #6b7280;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

/* API测试容器 */
.api-test-container {
    display: grid;
    grid-template-columns: 300px 1fr 1fr;
    gap: 25px;
    height: 600px;
}

.api-endpoints,
.test-area,
.result-area {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.api-endpoints h3,
.test-area h3,
.result-area h3 {
    background: #f8fafc;
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    margin: 0;
    font-size: 1em;
    color: #374151;
}

.endpoint-list,
.test-form,
.result-content {
    padding: 20px;
    height: calc(100% - 60px);
    overflow-y: auto;
}

/* 端点列表 */
.endpoint-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.endpoint-item:hover {
    background: #f8fafc;
    border-color: #4f46e5;
}

.endpoint-item.active {
    background: #eef2ff;
    border-color: #4f46e5;
}

.endpoint-method {
    font-weight: 600;
    font-size: 0.8em;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 8px;
}

.endpoint-method.GET {
    background: #dcfce7;
    color: #166534;
}

.endpoint-method.POST {
    background: #dbeafe;
    color: #1e40af;
}

.endpoint-method.PUT {
    background: #fef3c7;
    color: #92400e;
}

.endpoint-method.DELETE {
    background: #fecaca;
    color: #991b1b;
}

.endpoint-path {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #374151;
}

/* WebSocket容器 */
.websocket-container {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.websocket-status {
    background: #f8fafc;
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.status-indicator {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
}

.status-indicator.connected {
    background: #dcfce7;
    color: #166534;
}

.status-indicator.disconnected {
    background: #fecaca;
    color: #991b1b;
}

.status-indicator.connecting {
    background: #fef3c7;
    color: #92400e;
}

.websocket-log {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    background: #1f2937;
    color: #f9fafb;
}

.log-placeholder {
    color: #6b7280;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

.log-entry {
    margin-bottom: 8px;
    padding: 8px;
    border-radius: 4px;
}

.log-entry.sent {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid #3b82f6;
}

.log-entry.received {
    background: rgba(16, 185, 129, 0.1);
    border-left: 3px solid #10b981;
}

.log-entry.error {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
}

.log-timestamp {
    color: #9ca3af;
    font-size: 0.8em;
}

/* 加载和占位符 */
.loading {
    text-align: center;
    padding: 40px;
    color: #6b7280;
    font-style: italic;
}

.placeholder {
    color: #6b7280;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

/* 通知样式 */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.notification {
    background: white;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-left: 4px solid #4f46e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.notification-success {
    border-left-color: #10b981;
}

.notification-error {
    border-left-color: #ef4444;
}

.notification-warning {
    border-left-color: #f59e0b;
}

.notification button {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: #6b7280;
    margin-left: 15px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 测试结果样式 */
.test-result {
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
}

.test-result.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.test-result.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-weight: 600;
}

.result-icon {
    font-size: 1.2em;
}

.result-title {
    flex: 1;
    color: #374151;
}

.result-time {
    font-size: 0.8em;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 12px;
}

.result-status {
    font-size: 0.9em;
    color: #6b7280;
    margin-bottom: 5px;
}

.result-summary {
    color: #374151;
    margin-bottom: 10px;
}

.result-error {
    color: #dc2626;
    font-weight: 500;
    margin-bottom: 10px;
}

.result-details {
    margin-top: 10px;
}

.result-details summary {
    cursor: pointer;
    color: #4f46e5;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.result-data {
    background: #1f2937;
    color: #f9fafb;
    padding: 15px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.8em;
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .api-test-container {
        grid-template-columns: 250px 1fr;
        grid-template-rows: 1fr 1fr;
    }

    .result-area {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .container {
        margin: 0;
        border-radius: 0;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .nav-tabs {
        flex-wrap: wrap;
    }

    .nav-tab {
        flex: 1;
        min-width: 100px;
        font-size: 0.8em;
        padding: 12px 15px;
    }

    .tab-content {
        padding: 20px;
    }

    .test-grid {
        grid-template-columns: 1fr;
    }

    .api-test-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        height: auto;
    }

    .api-endpoints,
    .test-area,
    .result-area {
        height: 300px;
    }

    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .section-actions {
        justify-content: center;
        flex-wrap: wrap;
    }

    .websocket-log {
        height: 300px;
    }

    .notification-container {
        left: 10px;
        right: 10px;
    }

    .notification {
        min-width: auto;
    }

    .result-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .result-time {
        order: 3;
        flex-basis: 100%;
        text-align: center;
    }
}
